             package com.java.diagnostics.visualizer.gc.realtimeV2.parser;
             
             public class IntervalManager
             {
               long lastHeartbeat;
               
               long lastSynchGC;
               
               long lastTriggerStart;
               
               long lastTriggerEnd;
               
               long lastCycleStart;
               
               long lastCycleEnd;
               
               CommonData commonData;
               
               IntervalManager(CommonData commonData)
               {
                 this.commonData = commonData;
               }
               
               private long getLastMetronomeTime()
               {
                 return Math.max(Math.max(Math.max(Math.max(this.lastHeartbeat, this.lastSynchGC), 
                   this.lastTriggerStart), this.lastTriggerEnd), this.commonData.getInitialTimeMicros());
               }
               
               long getTimeForHeartbeat(long currentIntervalMicros)
               {
                 return this.lastHeartbeat = getLastMetronomeTime() + currentIntervalMicros;
               }
               
               long getTimeForSynchGC(long currentIntervalMicros)
               {
                 return this.lastSynchGC = getLastMetronomeTime() + currentIntervalMicros;
               }
               
               long getTimeForTriggerStart(long currentIntervalMicros)
               {
                 return this.lastTriggerStart = currentIntervalMicros + Math.max(this.commonData.getInitialTimeMicros(), this.lastTriggerEnd);
               }
               
               long getTimeForTriggerEnd(long currentIntervalMicros)
               {
                 return this.lastTriggerEnd = currentIntervalMicros + Math.max(this.commonData.getInitialTimeMicros(), this.lastTriggerStart);
               }
               
               long getTimeForCycleStart(long currentIntervalMicros)
               {
                 return this.lastCycleStart = currentIntervalMicros + Math.max(this.commonData.getInitialTimeMicros(), this.lastCycleEnd);
               }
               
               long getTimeForCycleEnd(long currentIntervalMicros)
               {
                 return this.lastCycleEnd = currentIntervalMicros + Math.max(this.commonData.getInitialTimeMicros(), this.lastCycleStart);
               }
             }


